package com.example.demo.zuhe;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description   院系
 * @Author youxin
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2022/1/17
 */
public class College extends OrganizationComponent{
    List<OrganizationComponent> list=new ArrayList<>();

    public College(String name, String desc) {
        super(name, desc);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        list.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        list.remove(organizationComponent);
    }

    @Override
    public String getDesc() {
        return super.getDesc();
    }

    @Override
    public String getName() {
        return super.getName();
    }


    //打印
    @Override
    protected void print() {
        System.out.println("------------"+getName()+"---------------------");
        //遍历
        for (OrganizationComponent organization: list) {
            organization.print();
        }
    }

}
